import scala.tools.reflect.ToolBox

object Case7_eval extends App{

  //  val build = scala.reflect.runtime.universe.build
  //  val x = build.setTypeSignature(build.newFreeTerm("x", 2), typeOf[Int])
  val tb = scala.reflect.runtime.currentMirror.mkToolBox()
  case class MyObj(a:String)
  val tree = tb.parse(
    """case class A { def fun(a:MyObj):Unit = {println(a.a)}}; A()""".stripMargin)
  val result = tb.eval(tree).asInstanceOf[{def fun(a:MyObj):Unit}]
    result.fun(new MyObj("zjt"))

}